﻿using ERCS.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;

namespace ERCS
{
    public static class Utils
    {
        public static Hospital Hospital(this LoginUserInfo self)
        {
            if (self.Attributes != null && self.Attributes.ContainsKey("Hospital") && self.Attributes["Hospital"] != null)
            {
                return JsonConvert.DeserializeObject<Hospital>(self.Attributes["Hospital"].ToString());
            }
            else
            {
                return null;
            }
        }
    }
}
